package spring.cloud.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.config.server.ConfigServerApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//@SpringBootApplication
@Configuration
@EnableAutoConfiguration
@EnableConfigServer
public class SpringCloudConfigServerApplication {

  @Value("${spring.config.name}")
  String name = "World";

  @RequestMapping("/")
  public String home() {
    return "Hello " + name;
  }

  public static void main(String[] args) {
    new SpringApplicationBuilder(SpringCloudConfigServerApplication.class)
            .properties("spring.config.name=config-server").run(args);
    //SpringApplication.run(SpringCloudConfigServerApplication.class, args);
  }

}